<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Average Throughput Calculation Mode</title>

    <script src="../../dist/modern/umd/dash.all.debug.js"></script>

    <!-- Bootstrap core CSS -->
    <link href="../lib/bootstrap/bootstrap.min.css" rel="stylesheet">
    <link href="../lib/main.css" rel="stylesheet">

    <style>
        video {
            width: 640px;
            height: 360px;
        }
    </style>

    <script class="code">
        function init() {
            var video,
                player,
                url = "https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd";

            video = document.querySelector("video");
            player = dashjs.MediaPlayer().create();

            player.updateSettings({
                streaming: {
                    abr: {
                        throughput: {
                            averageCalculationMode: dashjs.Constants.THROUGHPUT_CALCULATION_MODES.BYTE_SIZE_WEIGHTED_HARMONIC_MEAN,
                            sampleSettings: {
                                vod: 5,
                                enableSampleSizeAdjustment: false
                            }
                        },
                    }
                }
            });


            player.initialize(video, url, true);
        }
    </script>
</head>
<body>

<main>
    <div class="container py-4">
        <header class="pb-3 mb-4 border-bottom">
            <img class=""
                 src="../lib/img/dashjs-logo.png"
                 width="200">
        </header>
        <div class="row">
            <div class="col-md-4">
                <div class="h-100 p-5 bg-light border rounded-3">
                    <h3>Configuration of the average throughput calculation modes</h3>
                    <p>dash.js provides multiple options to configure the calculation of the current average throughput.
                        This
                        calculation is an important input for most of the ABR rules. In this example we change the
                        default mode to byte size weighted harmonic mean. In addition, we change the number of samples
                        to
                        be used to five and disable the automatic adjustment of the sample size.
                    </p>
                    <p>For a complete list of options and an explanation on the different calculation modes check our
                        documentation.</p>
                </div>
            </div>
            <div class="col-md-8">
                <video controls="true"></video>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div id="code-output"></div>
            </div>
        </div>
        <footer class="pt-3 mt-4 text-muted border-top">
            &copy; DASH-IF
        </footer>
    </div>
</main>


<script>
    document.addEventListener('DOMContentLoaded', function () {
        init();
    });
</script>
<script src="../highlighter.js"></script>
</body>
</html>
